package com.googlecode.tracey.ui.core;

import com.googlecode.totallylazy.Callable1;

import java.util.ArrayList;
import java.util.List;

public class Extensions {
    private final List<Extension> extensions = new ArrayList<Extension>();

    public Extensions add(Extension extension) {
        extensions.add(extension);
        return this;
    }

    public List<Extension> extensions() {
        return extensions;
    }

    public static Callable1<Extension, Extensions> addTo(final Extensions extensions) {
        return new Callable1<Extension, Extensions>() {
            @Override
            public Extensions call(Extension extension) throws Exception {
                return extensions.add(extension);
            }
        };
    }
}
